from django.db import models

# Create your models here.
ROLE=(
    ('1','学生'),
    ('2','老师')
)
class Users(models.Model):
    id=models.AutoField(primary_key=True)
    uname=models.CharField(max_length=20,null=False)
    upwd=models.CharField(max_length=20,null=False)
    role=models.IntegerField(max_length=1,choices=ROLE,null=False)

class LeaveC(models.Model):
    id = models.AutoField(primary_key=True)
    tname=models.CharField(max_length=20,null=False)

STATUS=(
    ('0','待审核'),
    ('1','通过'),
    ('2','未通过'),
)
class Leave(models.Model):
    id = models.AutoField(primary_key=True)
    stu_name=models.CharField(max_length=20, null=False)
    status=models.CharField(max_length=20, null=False,choices=STATUS,default='0')
    createTime=models.TimeField(null=False)
    context=models.CharField(max_length=200, null=False)
    tid=models.ForeignKey(to='LeaveC',on_delete=models.CASCADE)